package com.vidmt.api.modules.sys.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.thinkgem.jeesite.common.persistence.CrudDao;
import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
import com.vidmt.api.modules.sys.entity.Property;

/**
 * 日志DAO接口
 * 
 * @author ThinkGem
 * @version 2014-05-16
 */
@MyBatisDao
public interface PropertyDao extends CrudDao<Property> {
	@Select("SELECT * FROM v_property WHERE `key`=#{0}")
	public Property get(String name);

	@Override
	@Select("SELECT * FROM v_property")
	public List<Property> findList(Property entity);

	@Override
	@Insert("INSERT INTO v_property(`key`,`value`,remark) VALUES (#{key},#{value},#{remark})")
	public int insert(Property entity);

	@Insert("INSERT INTO v_property(`key`,`value`,remark) VALUES (#{key},#{value},#{remark})ON DUPLICATE KEY "
			+ "UPDATE `value`=VALUES(`value`), remark=VALUES(remark)")
	public int insertOrUpdate(Property entity);
	
	@Override
	@Update("UPDATE v_property SET `value`=#{value},remark=#{remark} WHERE `key`=#{key}")
	public int update(Property entity);

	@Select("SELECT `value` FROM v_property WHERE `key`=#{0} ")
	public String getValue(String key);

	@Override
	@Delete("DELETE FROM v_property WHERE `key`=#{key}")
	int delete(Property entity);
}
